CREATE TABLE [dbo].[wld_tablas_programa]
(
[nm_programa] [dbo].[_codigo_largo] NOT NULL,
[nm_tabla] [dbo].[_nombre] NOT NULL,
[de_relacion] [dbo].[_descripcion] NOT NULL,
[nu_orden] [dbo].[_entero] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wld_tablas_programa] ADD CONSTRAINT [PK_wld_tablas_programa] PRIMARY KEY CLUSTERED  ([nm_programa], [nm_tabla]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[wld_tablas_programa] ADD CONSTRAINT [FK_wld_tablas_programa_wad_programas] FOREIGN KEY ([nm_programa]) REFERENCES [dbo].[wad_programas] ([nm_programa]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[wld_tablas_programa] ADD CONSTRAINT [FK_wld_tablas_programa_wad_tablas] FOREIGN KEY ([nm_tabla]) REFERENCES [dbo].[wad_tablas] ([nm_tabla]) ON DELETE CASCADE ON UPDATE CASCADE
GO
EXEC sp_bindefault N'[dbo].[cero]', N'[dbo].[wld_tablas_programa].[nu_orden]'
GO
